package pab.core.service;

import java.util.List;

import javax.xml.datatype.XMLGregorianCalendar;

import pab.core.account.Account;
import pab.core.exception.AccountException;
import pab.core.exception.TransactionException;
import pab.core.transaction.Currency;
import pab.core.transaction.ProjectedInterval;
import pab.core.transaction.Transaction;
import pab.core.transaction.TransactionType;

public interface AccountService {
	public void save();
	
	public Account openAccount(String number, String name, Currency currency, double balance) throws AccountException;
	public void closeAccount(Account account) throws AccountException;
	
	public List<Account> listAccounts();
	public Account getAccount(String number);
	public Transaction makePriliminaryTransaction(Account account, TransactionType type, double amount, Currency currency, String desc, XMLGregorianCalendar date) throws TransactionException;
	public Transaction makePriliminaryTransaction(Account account, TransactionType type, double amount, Currency currency, String desc, 
			XMLGregorianCalendar date, ProjectedInterval interval) throws TransactionException;
	
	public List<Transaction> listTransactions() throws AccountException;
	public List<Transaction> listTransactions(Account account) throws AccountException;
	public List<Transaction> listTransactions(Account account, boolean preliminary) throws AccountException;
	public List<Transaction> listTransactions(Account account, Condition condition) throws AccountException;
	
	public List<Transaction> listTransactions(Account account, XMLGregorianCalendar fromDate, XMLGregorianCalendar toDate) throws AccountException;
	public List<Transaction> listTransactions(Account account, boolean preliminary, XMLGregorianCalendar fromDate,
			XMLGregorianCalendar toDate) throws AccountException;
	public List<Transaction> listTransactions(Account account,
			Condition condition, XMLGregorianCalendar fromDate, XMLGregorianCalendar toDate)
			throws AccountException;
	
	public List<Transaction> listLatestProjectedTransaction();
	
	public void clearTransation(Transaction transaction) throws TransactionException;
	public void deleteTransation(Transaction transaction) throws TransactionException;
	public void setProjected(Transaction transaction, boolean projected) throws TransactionException;
	
	public void balanceAccount(Account account) throws AccountException;
	
	public ExchangeRate getExchangeService(); 
	
}
